package com.gruppe1.inu.Notififations;



import java.util.ArrayList;
import java.util.List;


import com.gruppe1.inu.R;
import com.gruppe1.inu.SelectMediaActivity;
import com.gruppe1.inu.ListAdapters.NotifListAdapter;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

public class DelayedActivity extends Activity {

	public static final String SMS_RECIPIENT_EXTRA = "com.example.android.apis.os.SMS_RECIPIENT";

	public static final String ACTION_SMS_SENT = "com.example.android.apis.os.SMS_SENT_ACTION";

	private ListView listView;
	private String[] list;


	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.notifs_container);

		list = getResources().getStringArray(R.array.Delayed_strings);
		listView = (ListView) findViewById(R.id.listView);

		listView.setAdapter(new NotifListAdapter(this, R.layout.notif_list_item, list));
		
		
		listView.setOnItemClickListener(new OnItemClickListener() {
		
			 
			public void onItemClick(AdapterView<?> parent, View v, int pos,
					long id) {
				// TODO send sms
				Intent i = new Intent(DelayedActivity.this, SelectMediaActivity.class);
				startActivity(i);
			}
		});


	}
	
	
	public void sendSMS(int pos, String recipient){
		SmsManager sms = SmsManager.getDefault();

		ArrayList<String> messages = sms.divideMessage(list[pos]);

		

			sms.sendMultipartTextMessage(recipient, null, messages, null, null);

		Toast.makeText(DelayedActivity.this, "sms sendt!", Toast.LENGTH_SHORT).show();
	}






}


